/**
 * 积分面板
 */
class ScorePanel {
    private score = 0;
    private level = 1;

    score_ele: HTMLElement;
    level_ele: HTMLElement;

    //限定等级
    max_level: number;
    //多少分升级
    up_score: number;


    constructor(max_level: number = 10, up_score: number = 10) {
        this.score_ele = document.getElementById('score')!;
        this.level_ele = document.getElementById('level')!;
        this.max_level = max_level;
        this.up_score = up_score;
    }

    addScore() {
        this.score_ele.innerHTML = ++this.score + "";

        if (this.score % this.up_score === 0) {
            this.levelUp();
        }
    }

    levelUp() {
        if (this.level < this.max_level) {
            this.level_ele.innerHTML = ++this.level + "";
        }
    }

    
    get mLevel(){
        return this.level;
    }
    

}

export default ScorePanel;

// const score_panel = new ScorePanel();
// score_panel.addScore()